package com.fpx.order.plat.bussiness.plat.base;

import java.text.SimpleDateFormat;
import java.util.List;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;

import com.fpx.order.plat.bussiness.entity.CustomerShop;
import com.fpx.order.plat.bussiness.service.customer.ICustomerShopService;

/**
 * desc:
 * @author xiangtao(xiangtao@4px.com)
 * @date 2015年11月24日 下午5:59:38
 * @version 1.0
 */

public abstract class PlatOrderCurrentJob {
	
	private final static Logger LOGGER = Logger.getLogger(PlatOrderCurrentJob.class);
	
	
	protected SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
	
	/**
	 * 店铺列表
	 */
	private List<CustomerShop> customers;
	
	
	
	/**
	 * 店铺信息service
	 */
	@Autowired
	private ICustomerShopService customerShopService;
	
	
	/**
	 * 共公加载客户 配置信息
	 * @author xiangtao(xiangtao@4px.com)
	 * @param orderSource 平台编码
	 */
	public void initMeodth(String platCode){
		if(platCode==null||platCode.trim().equals("")){
			LOGGER.info("请设置平台编码");
			return;
		}
		try {
			customers = customerShopService.findByPlatCustomerShop(platCode);
		} catch (Exception e) {
			LOGGER.error("通过平台编码["+platCode+"]查询所有可用店铺异常---异常信息："+e.getMessage());
		}
		if (null == this.getCustomers() || this.getCustomers().size() == 0) {
			LOGGER.error("获取店铺及集合失败");
		}
	}

	public List<CustomerShop> getCustomers() {
		return customers;
	}


	public void setCustomers(List<CustomerShop> customers) {
		this.customers = customers;
	}


	
}
